<?php if (!$model->isNewRecord): ?>
<a href="<?php echo $this->createUrl('/Shop/admin/product/assignGroups', array('id'=>$model->id));?>" class="xtarget-detail ">Assign Group Attributes</a>
<?php endif;?>
<legend>Attributes</legend>
<?php
foreach ($attrs as $key => $attr):
    ?>
<div class="control-group">
    <label class="control-label"><?php echo $attr['name'] ?></label>

    <div class="controls">
        <?php
        $attrClass = '';
        if ($attr['required'] == true) {
            $attrClass = 'required-attr-group';
        }
        if ($attr['type'] == AttributeGroup::TYPE_MULTIPLE) {
            echo CHtml::dropDownList('group['.$key .'][]', $this->findSelected($model, $key), $attr['data'], array('multiple' => 'multiple', 'class' => $attrClass));
        }
        else {
            echo CHtml::dropDownList('group['.$key .']', $this->findSelected($model, $key), $attr['data'], array('prompt' => '---Select---','class' => $attrClass));
        }
        ?>
        <div class="errorMessage" style="display: none;"><?php echo 'Please select value for '.$attr['name']; ?></div>
    </div>
</div>
<?php endforeach; ?>